package com.szrt.java.day20161226.demo14;

import com.szrt.java.day20161226.demo12.ArrayUtil;

/**
 * 输入一个不大于5位的正整数，然后判断它是几位数，打印出各位数，并逆序输出这个整数。   1<=x<=99999 10000
 * @author Administrator  
 * 1<=x<10       1  7   7      7
 * 10<=x<100    20  2  12  1,2    2,1
 * 100<=x<1000  3  234 2,3,4  4,32
 *
 */
public class Demo02 {
	
	@SuppressWarnings("unused")
	public static void main(String[] args) {
		
		//1 让用户从键盘输入1个数字
		
		int num=23456;
		
		if(num/10000>=1){
			
			int[] arrays = new int[5];
			int gewei=qiugewei(num);
			arrays[0]=gewei;
			int shiwei = num%100/10;
			arrays[1]=shiwei;
			int baiwei = num%1000/100;
			arrays[2]=baiwei;
			int qianwei = num%10000/1000;
			arrays[3]=qianwei;
			int wanwei = num/10000;
			arrays[4]=wanwei;
			
			ArrayUtil.printArray(arrays);
			
			System.out.println("5位数...");
		}else if(num/1000>=1){
			qiugewei(num);
			int shiwei = num%100/10;
			int baiwei = num%1000/100;
			int qianwei = num/1000;
			System.out.println("4位数...");
			
		}else if(num/100>=1){
			System.out.println("3位数...");
		}else if(num/10>=1){
			System.out.println("2位数...");
			
		}else{
			System.out.println("1位数...");
			
		}
		
		
		//2 /求整数来做  知道它是几位数
		
		
		
		//System.out.println(34/100);
		
		
	}

	public static int qiugewei(int num) {
		int gewei = num % 10;
		return gewei;
	}

}
